home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / plnk081.zip / pilot-link.0.8.1 / Java / Pdapilot / mail / sort.java < prev    next >
Encoding:
Java Source  |  1997-08-08  |  799 b   |  44 lines

  1.  
  2. package Pdapilot.mail;
  3.  
  4. public class sort {
  5.     private int idx;
  6.     
  7.     final static private String[] names = new String[2];
  8.     private static sort[] objs = new sort[2];
  9.  
  10.     public static sort Date = new sort(0, "Date");
  11.     public static sort Type =  new sort(1, "Type");
  12.     
  13.     private sort(int value, String name) {
  14.         this.idx = value;
  15.         objs[value] = this;
  16.         names[value] = name;
  17.     }
  18.     
  19.     public static sort get(int value) {
  20.         return objs[value];
  21.     }
  22.     public static sort get(String value) {
  23.         int i;
  24.         for(i=0;i<names.length;i++)
  25.             if (names[i].equals(value))
  26.                 return objs[i];
  27.         return null;
  28.     }
  29.     public static String[] getNames() {
  30.         return names;
  31.     }
  32.     
  33.     public String toString() {
  34.         return "sort."+names[idx];
  35.     }
  36.         
  37.     public int getValue() {
  38.         return idx;
  39.     }
  40.  
  41.     public String getName() {
  42.         return names[idx];
  43.     }
  44. };